package com.scalar.chiptrack.operations.finishedGoods.forms;

import java.util.ArrayList;
import java.util.Iterator;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionMapping;

import com.scalar.chiptrack.ChipTrackActionForm;
import com.scalar.chiptrack.operations.finishedGoods.EquivalentPartNumber;

/**
 * User: Murali Krishna Yengala
 * Date: May 27, 2005
 * Time: 10:45:21 AM
 */
public class FinishedGoodsEntryForm extends ChipTrackActionForm {

    String processStepId = null;
    int processStepIdI = -1;

    String baseProductId = null;
    int baseProductIdI = -1;
    String baseProductNo = null;

    String[] fgiProcessStepIds = null;
    String fgiProductNo = null;

    String baseProcessType = "Finished Goods";

    String customerName = null;
    String customerId = null;
    int customerIdI = -1;

    int finishedGoodsProductId = -1;
    String finishedGoodsPartNo = null;
    String mktgPartNo = null;
    boolean approved = false;
    String programCode = null;
    String description = null;

    ArrayList equivalentPartNosList = null;
    ArrayList parametersList = null;
    ArrayList vendorList = null;

    int algorithmId = -1;
    String algorithm = null;

    String crc = "0";

    String[] customerIds = null;
    String isBlankProduct = null; // '0' - it is a blank product, '1' - not a blank product, null or '' - don't know

    public String getProcessStepId() {
        return processStepId;
    }

    public void setProcessStepId(String processStepId) {
        this.processStepId = processStepId;
    }

    public int getProcessStepIdI() {
        return processStepIdI;
    }

    public void setProcessStepIdI(int processStepIdI) {
        this.processStepIdI = processStepIdI;
    }

    public String getBaseProductId() {
        return baseProductId;
    }

    public void setBaseProductId(String baseProductId) {
        this.baseProductId = baseProductId;
    }

    public String getBaseProductNo() {
        return baseProductNo;
    }

    public void setBaseProductNo(String baseProductNo) {
        this.baseProductNo = baseProductNo;
    }

    public String[] getFgiProcessStepIds() {
        return fgiProcessStepIds;
    }

    public void setFgiProcessStepIds(String[] fgiProcessStepIds) {
        this.fgiProcessStepIds = fgiProcessStepIds;
    }

    public String getFgiProductNo() {
        return fgiProductNo;
    }

    public void setFgiProductNo(String fgiProductNo) {
        this.fgiProductNo = fgiProductNo;
    }

    public String getBaseProcessType() {
        return baseProcessType;
    }

    public void setBaseProcessType(String baseProcessType) {
        this.baseProcessType = baseProcessType;
    }

    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

    public String getCustomerId() {
        return customerId;
    }

    public void setCustomerId(String customerId) {
        this.customerId = customerId;
    }

    public int getFinishedGoodsProductId() {
        return finishedGoodsProductId;
    }

    public void setFinishedGoodsProductId(int finishedGoodsProductId) {
        this.finishedGoodsProductId = finishedGoodsProductId;
    }

    public String getFinishedGoodsPartNo() {
        return finishedGoodsPartNo;
    }

    public void setFinishedGoodsPartNo(String finishedGoodsPartNo) {
        this.finishedGoodsPartNo = finishedGoodsPartNo;
    }

    public String getMktgPartNo() {
        return mktgPartNo;
    }

    public void setMktgPartNo(String mktgPartNo) {
        this.mktgPartNo = mktgPartNo;
    }

    public boolean isApproved() {
        return approved;
    }

    public void setApproved(boolean approved) {
        this.approved = approved;
    }

    public String getProgramCode() {
        return programCode;
    }

    public void setProgramCode(String programCode) {
        this.programCode = programCode;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public ArrayList getEquivalentPartNosList() {
        return equivalentPartNosList;
    }

    public void setEquivalentPartNosList(ArrayList equivalentPartNosList) {
        this.equivalentPartNosList = equivalentPartNosList;
    }

    public ArrayList getParametersList() {
        return parametersList;
    }

    public void setParametersList(ArrayList parametersList) {
        this.parametersList = parametersList;
    }

    public ArrayList getVendorList() {
        return vendorList;
    }

    public void setVendorList(ArrayList vendorList) {
        this.vendorList = vendorList;
    }

    public int getBaseProductIdI() {
        return baseProductIdI;
    }

    public void setBaseProductIdI(int baseProductIdI) {
        this.baseProductIdI = baseProductIdI;
    }

    public int getCustomerIdI() {
        return customerIdI;
    }

    public void setCustomerIdI(int customerIdI) {
        this.customerIdI = customerIdI;
    }


    public int getAlgorithmId() {
        return algorithmId;
    }

    public void setAlgorithmId(int algorithmId) {
        this.algorithmId = algorithmId;
    }

    public String getCrc() {
        return crc;
    }

    public void setCrc(String crc) {
        this.crc = crc;
    }

    public String getAlgorithm() {
        return algorithm;
    }

    public void setAlgorithm(String algorithm) {
        this.algorithm = algorithm;
    }

    public String[] getCustomerIds() {
        return customerIds;
    }

    public void setCustomerIds(String[] customerIds) {
        this.customerIds = customerIds;
    }

    public String getIsBlankProduct()
    {
        return isBlankProduct;
    }

    public void setIsBlankProduct(String isBlankProduct)
    {
        this.isBlankProduct = isBlankProduct;
    }

    public void reset( ActionMapping mapping , HttpServletRequest request )
    {
        this.setApproved(false);
        if( this.getEquivalentPartNosList() != null )
        {
            Iterator equivalentPartNosIte = this.getEquivalentPartNosList().iterator();
            while( equivalentPartNosIte.hasNext() )
            {
                EquivalentPartNumber equivalentPartNo = (EquivalentPartNumber) equivalentPartNosIte.next();
                equivalentPartNo.setDelete( false);
            }

        }
/*
        if( this.getParametersList() != null )
        {
            Iterator paremetersIte = this.getParametersList().iterator();
            while( paremetersIte.hasNext() )
            {
                ProcessParameters parameter = (ProcessParameters) paremetersIte.next();
                parameter.setDelete( false);
            }
        }
*/
    }

}
